<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.6.2" />
<title>pandas_profiling API documentation</title>
<meta name="description" content="Main module of pandas-profiling …" />
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css' rel='stylesheet'>
<link href='https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/8.0.0/sanitize.min.css' rel='stylesheet'>
<link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css" rel="stylesheet">
<style>.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{font-weight:bold}#index h4 + ul{margin-bottom:.6em}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase;cursor:pointer}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}.admonition{padding:.1em .5em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
</head>
<body>
<main>
<article id="content">
<header>
<h1 class="title">Module <code>pandas_profiling</code></h1>
</header>
<section id="section-intro">
<p>Main module of pandas-profiling.</p>
<h1 id="pandas-profiling">Pandas Profiling</h1>
<p><a href="https://travis-ci.com/pandas-profiling/pandas-profiling"><img alt="Build Status" src="https://travis-ci.com/pandas-profiling/pandas-profiling.svg?branch=master"></a>
<a href="https://codecov.io/gh/pandas-profiling/pandas-profiling"><img alt="Code Coverage" src="https://codecov.io/gh/pandas-profiling/pandas-profiling/branch/master/graph/badge.svg?token=gMptB4YUnF"></a>
<a href="https://github.com/pandas-profiling/pandas-profiling/releases"><img alt="Release Version" src="https://img.shields.io/github/release/pandas-profiling/pandas-profiling.svg"></a>
<a href="https://github.com/python/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a></p>
<p>Generates profile reports from a pandas <code>DataFrame</code>.
The pandas <code>df.describe()</code> function is great but a little basic for serious exploratory data analysis.
<a title="pandas_profiling" href="#pandas_profiling"><code>pandas_profiling</code></a> extends the pandas DataFrame with <code>df.profile_report()</code> for quick data analysis.</p>
<p>For each column the following statistics - if relevant for the column type - are presented in an interactive HTML report:</p>
<ul>
<li><strong>Essentials</strong>: type, unique values, missing values</li>
<li><strong>Quantile statistics</strong> like minimum value, Q1, median, Q3, maximum, range, interquartile range</li>
<li><strong>Descriptive statistics</strong> like mean, mode, standard deviation, sum, median absolute deviation, coefficient of variation, kurtosis, skewness</li>
<li><strong>Most frequent values</strong></li>
<li><strong>Histogram</strong></li>
<li><strong>Correlations</strong> highlighting of highly correlated variables, Spearman, Pearson and Kendall matrices</li>
<li><strong>Missing values</strong> matrix, count, heatmap and dendrogram of missing values</li>
</ul>
<h2 id="examples">Examples</h2>
<p>The following examples can give you an impression of what the package can do:</p>
<ul>
<li><a href="http://pandas-profiling.github.io/pandas-profiling/examples/census/census_report.html">Census Income</a> (US Adult Census data relating income)</li>
<li><a href="http://pandas-profiling.github.io/pandas-profiling/examples/meteorites/meteorites_report.html">NASA Meteorites</a> (comprehensive set of meteorite landings)</li>
<li><a href="http://pandas-profiling.github.io/pandas-profiling/examples/titanic/titanic_report.html">Titanic</a> (the "Wonderwall" of datasets)</li>
<li><a href="http://pandas-profiling.github.io/pandas-profiling/examples/nza/nza_report.html">NZA</a> (open data from the Dutch Healthcare Authority)</li>
<li><a href="http://pandas-profiling.github.io/pandas-profiling/examples/stata_auto/stata_auto_report.html">Stata Auto</a> (1978 Automobile data)</li>
<li><a href="http://pandas-profiling.github.io/pandas-profiling/examples/website_inaccessibility/website_inaccessibility_report.html">Website Inaccessibility</a> (demonstrates the URL type)</li>
</ul>
<h2 id="installation">Installation</h2>
<h3 id="using-pip">Using pip</h3>
<p><a href="https://pepy.tech/project/pandas-profiling"><img alt="PyPi Downloads" src="https://pepy.tech/badge/pandas-profiling"></a>
<a href="https://pepy.tech/project/pandas-profiling/month"><img alt="PyPi Monthly Downloads" src="https://pepy.tech/badge/pandas-profiling/month"></a>
<a href="https://pypi.org/project/pandas-profiling/"><img alt="PyPi Version" src="https://badge.fury.io/py/pandas-profiling.svg"></a></p>
<p>You can install using the pip package manager by running</p>
<pre><code>pip install pandas-profiling
</code></pre>
<p>Alternatively, you could install directly from Github:</p>
<pre><code>pip install &lt;https://github.com/pandas-profiling/pandas-profiling/archive/master.zip&gt;
</code></pre>
<h3 id="using-conda">Using conda</h3>
<p><a href="https://anaconda.org/conda-forge/pandas-profiling"><img alt="Conda Downloads" src="https://img.shields.io/conda/dn/conda-forge/pandas-profiling.svg"></a>
<a href="https://anaconda.org/conda-forge/pandas-profiling"><img alt="Conda Version" src="https://img.shields.io/conda/vn/conda-forge/pandas-profiling.svg"></a> </p>
<p>You can install using the conda package manager by running</p>
<pre><code>conda install -c conda-forge pandas-profiling
</code></pre>
<h3 id="from-source">From source</h3>
<p>Download the source code by cloning the repository or by pressing <a href="https://github.com/pandas-profiling/pandas-profiling/archive/master.zip">'Download ZIP'</a> on this page.
Install by navigating to the proper directory and running</p>
<pre><code>python setup.py install
</code></pre>
<h2 id="usage">Usage</h2>
<p>The profile report is written in HTML5 and CSS3, which means pandas-profiling requires a modern browser. </p>
<h2 id="documentation">Documentation</h2>
<p>The documentation for <a title="pandas_profiling" href="#pandas_profiling"><code>pandas_profiling</code></a> can be found <a href="https://pandas-profiling.github.io/pandas-profiling/docs/">here</a>.
The documentation is generated using <a href="https://github.com/pdoc3/pdoc"><code>pdoc3</code></a>.
If you are contributing to this project, you can rebuild the documentation using:</p>
<pre><code>make docs
</code></pre>
<p>or on Windows:</p>
<pre><code>make.bat docs
</code></pre>
<h3 id="jupyter-notebook">Jupyter Notebook</h3>
<p>We recommend generating reports interactively by using the Jupyter notebook. </p>
<p>Start by loading in your pandas DataFrame, e.g. by using</p>
<pre><code class="python">import numpy as np
import pandas as pd
import pandas_profiling

df = pd.DataFrame(
    np.random.rand(100, 5),
    columns=['a', 'b', 'c', 'd', 'e']
)
</code></pre>
<p>To display the report in a Jupyter notebook, run:</p>
<pre><code class="python">df.profile_report(style={'full_width':True})
</code></pre>
<p>To retrieve the list of variables which are rejected due to high correlation:</p>
<pre><code class="python">profile = df.profile_report()
rejected_variables = profile.get_rejected_variables(threshold=0.9)
</code></pre>
<p>If you want to generate a HTML report file, save the <code>ProfileReport</code> to an object and use the <code>to_file()</code> function:</p>
<pre><code class="python">profile = df.profile_report(title='Pandas Profiling Report')
profile.to_file(output_file=&quot;output.html&quot;)
</code></pre>
<h3 id="command-line-usage">Command line usage</h3>
<p>For standard formatted CSV files that can be read immediately by pandas, you can use the <code>pandas_profiling</code> executable. Run</p>
<pre><code>pandas_profiling -h
</code></pre>
<p>for information about options and arguments.</p>
<h3 id="advanced-usage">Advanced usage</h3>
<p>A set of options is available in order to adapt the report generated.</p>
<ul>
<li><code>title</code> (<code>str</code>): Title for the report ('Pandas Profiling Report' by default).</li>
<li><code>pool_size</code> (<code>int</code>): Number of workers in thread pool. When set to zero, it is set to the number of CPUs available (0 by default).</li>
<li><code>minify_html</code> (<code>boolean</code>): Whether to minify the output HTML.</li>
</ul>
<p>More settings can be found in the <a href="https://github.com/pandas-profiling/pandas-profiling/blob/master/pandas_profiling/config_default.yaml">default configuration file</a>.</p>
<p><strong>Example</strong></p>
<pre><code class="python">profile = df.profile_report(title='Pandas Profiling Report', plot={'histogram': {'bins': 8}})
profile.to_file(output_file=&quot;output.html&quot;)
</code></pre>
<h2 id="how-to-contribute">How to contribute</h2>
<p>The package is actively maintained and developed as open-source software.
If <code>pandas-profiling</code> was helpful or interesting to you, you might want to get involved.
There are several ways of contributing and helping our thousands of users.
If you would like to be a industry partner or sponsor, please <a href="mailto:pandasprofiling@gmail.com">drop us a line</a>.</p>
<p>Read more on getting involved in the <a href="https://github.com/pandas-profiling/pandas-profiling/blob/master/CONTRIBUTING.md">Contribution Guide</a>.</p>
<h2 id="editor-integration">Editor integration</h2>
<h3 id="pycharm-integration">PyCharm integration</h3>
<ol>
<li>Install <code>pandas-profiling</code> via the instructions above</li>
<li>
<p>Locate your <code>pandas-profiling</code> executable.</p>
<p>On macOS / Linux / BSD:</p>
<p><code>console
$ which pandas_profiling
(example) /usr/local/bin/pandas_profiling</code></p>
<p>On Windows:</p>
<p><code>console
$ where pandas_profiling
(example) C:\ProgramData\Anaconda3\Scripts\pandas_profiling.exe</code></p>
</li>
<li>
<p>In Pycharm, go to <em>Settings</em> (or <em>Preferences</em> on macOS) &gt; <em>Tools</em> &gt; <em>External tools</em></p>
</li>
<li>Click the <em>+</em> icon to add a new external tool</li>
<li>Insert the following values<ul>
<li>Name: Pandas Profiling</li>
<li>Program: <em><strong>The location obtained in step 2</strong></em></li>
<li>Arguments: "$FilePath$" "$FileDir$/$FileNameWithoutAllExtensions$_report.html"</li>
<li>Working Directory: $ProjectFileDir$</li>
</ul>
</li>
</ol>
<p><img alt="PyCharm Integration" src="http://pandas-profiling.github.io/pandas-profiling/docs/assets/pycharm-integration.png"></p>
<p>To use the PyCharm Integration, right click on any dataset file:
<em>External Tools</em> &gt; <em>Pandas Profiling</em>.</p>
<h3 id="other-integrations">Other integrations</h3>
<p>Other editor integrations may be contributed via pull requests.</p>
<h2 id="dependencies">Dependencies</h2>
<p>You need <a href="https://python3statement.org/">Python 3</a> to run this package. Other dependencies can be found in the requirements files:</p>
<table>
<thead>
<tr>
<th>Filename</th>
<th>Requirements</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://github.com/pandas-profiling/pandas-profiling/blob/master/requirements.txt">requirements.txt</a></td>
<td>Package requirements</td>
</tr>
<tr>
<td><a href="https://github.com/pandas-profiling/pandas-profiling/blob/master/requirements-dev.txt">requirements-dev.txt</a></td>
<td>Requirements for development</td>
</tr>
<tr>
<td><a href="https://github.com/pandas-profiling/pandas-profiling/blob/master/requirements-test.txt">requirements-test.txt</a></td>
<td>Requirements for testing</td>
</tr>
</tbody>
</table>
<details class="source">
<summary>Source code</summary>
<pre><code class="python">&#34;&#34;&#34;Main module of pandas-profiling.

.. include:: ../README.md
&#34;&#34;&#34;
import sys
import warnings

import pandas as pd

from pandas_profiling.version import __version__
from pandas_profiling.utils.dataframe import clean_column_names, rename_index
from pandas_profiling.utils.paths import get_config_default, get_project_root

from pathlib import Path
import numpy as np

from pandas_profiling.config import config
from pandas_profiling.controller import pandas_decorator
import pandas_profiling.view.templates as templates
from pandas_profiling.model.describe import describe as describe_df
from pandas_profiling.view.notebook import display_notebook_iframe
from pandas_profiling.view.report import to_html


class ProfileReport(object):
    &#34;&#34;&#34;Generate a profile report from a Dataset stored as a pandas `DataFrame`.
    
    Used has is it will output its content as an HTML report in a Jupyter notebook.
    &#34;&#34;&#34;

    html = &#34;&#34;
    &#34;&#34;&#34;the HTML representation of the report, without the wrapper (containing `&lt;head&gt;` etc.)&#34;&#34;&#34;

    def __init__(self, df, **kwargs):
        config.set_kwargs(kwargs)

        # Treat index as any other column
        if (
            not pd.Index(np.arange(0, len(df))).equals(df.index)
            or df.index.dtype != np.int64
        ):
            df = df.reset_index()

        # Rename reserved column names
        df = rename_index(df)

        # Remove spaces and colons from column names
        df = clean_column_names(df)

        # Sort column names
        sort = config[&#34;sort&#34;].get(str)
        if sys.version_info[1] &lt;= 5 and sort != &#34;None&#34;:
            warnings.warn(&#34;Sorting is supported from Python 3.6+&#34;)

        if sort in [&#34;asc&#34;, &#34;ascending&#34;]:
            df = df.reindex(sorted(df.columns, key=lambda s: s.casefold()), axis=1)
        elif sort in [&#34;desc&#34;, &#34;descending&#34;]:
            df = df.reindex(
                reversed(sorted(df.columns, key=lambda s: s.casefold())), axis=1
            )
        elif sort != &#34;None&#34;:
            raise ValueError(&#39;&#34;sort&#34; should be &#34;ascending&#34;, &#34;descending&#34; or None.&#39;)

        # Store column order
        config[&#34;column_order&#34;] = df.columns.tolist()

        # Get dataset statistics
        description_set = describe_df(df)

        # Get sample
        sample = {}
        n_head = config[&#34;samples&#34;][&#34;head&#34;].get(int)
        if n_head &gt; 0:
            sample[&#34;head&#34;] = df.head(n=n_head)

        n_tail = config[&#34;samples&#34;][&#34;tail&#34;].get(int)
        if n_tail &gt; 0:
            sample[&#34;tail&#34;] = df.tail(n=n_tail)

        # Render HTML
        self.html = to_html(sample, description_set)
        self.minify_html = config[&#34;minify_html&#34;].get(bool)
        self.use_local_assets = config[&#34;use_local_assets&#34;].get(bool)
        self.title = config[&#34;title&#34;].get(str)
        self.description_set = description_set
        self.sample = sample

    def get_description(self) -&gt; dict:
        &#34;&#34;&#34;Return the description (a raw statistical summary) of the dataset.
        
        Returns:
            Dict containing a description for each variable in the DataFrame.
        &#34;&#34;&#34;
        return self.description_set

    def get_rejected_variables(self, threshold: float = 0.9) -&gt; list:
        &#34;&#34;&#34;Return a list of variable names being rejected for high 
        correlation with one of remaining variables.
        
        Args:
            threshold: correlation value which is above the threshold are rejected (Default value = 0.9)

        Returns:
            A list of rejected variables.
        &#34;&#34;&#34;
        variable_profile = self.description_set[&#34;variables&#34;]
        result = []
        for col, values in variable_profile.items():
            if &#34;correlation&#34; in values:
                if values[&#34;correlation&#34;] &gt; threshold:
                    result.append(col)
        return result

    def to_file(self, output_file: Path or str, silent: bool = True) -&gt; None:
        &#34;&#34;&#34;Write the report to a file.
        
        By default a name is generated.

        Args:
            output_file: The name or the path of the file to generate including the extension (.html).
            silent: if False, opens the file in the default browser
        &#34;&#34;&#34;
        if type(output_file) == str:
            output_file = Path(output_file)

        with output_file.open(&#34;w&#34;, encoding=&#34;utf8&#34;) as f:
            wrapped_html = self.to_html()
            if self.minify_html:
                from htmlmin.main import minify

                wrapped_html = minify(
                    wrapped_html, remove_all_empty_space=True, remove_comments=True
                )
            f.write(wrapped_html)

        if not silent:
            import webbrowser

            webbrowser.open_new_tab(output_file)

    def to_html(self) -&gt; str:
        &#34;&#34;&#34;Generate and return complete template as lengthy string
            for using with frameworks.

        Returns:
            Profiling report html including wrapper.
        
        &#34;&#34;&#34;
        return templates.template(&#34;wrapper.html&#34;).render(
            content=self.html,
            title=self.title,
            correlation=len(self.description_set[&#34;correlations&#34;]) &gt; 0,
            missing=len(self.description_set[&#34;missing&#34;]) &gt; 0,
            sample=len(self.sample) &gt; 0,
            version=__version__,
            offline=self.use_local_assets,
            primary_color=config[&#34;style&#34;][&#34;primary_color&#34;].get(str),
            theme=config[&#34;style&#34;][&#34;theme&#34;].get(str),
        )

    def get_unique_file_name(self):
        &#34;&#34;&#34;Generate a unique file name.&#34;&#34;&#34;
        return (
            &#34;profile_&#34;
            + str(np.random.randint(1000000000, 9999999999, dtype=np.int64))
            + &#34;.html&#34;
        )

    def _repr_html_(self):
        &#34;&#34;&#34;Used to output the HTML representation to a Jupyter notebook.
        When config.notebook.iframe.attribute is &#34;src&#34;, this function creates a temporary HTML file
        in `./tmp/profile_[hash].html` and returns an Iframe pointing to that contents.
        When config.notebook.iframe.attribute is &#34;srcdoc&#34;, the same HTML is injected in the &#34;srcdoc&#34; attribute of
        the Iframe.

        Notes:
            This constructions solves problems with conflicting stylesheets and navigation links.
        &#34;&#34;&#34;
        display_notebook_iframe(self)

    def __repr__(self):
        &#34;&#34;&#34;Override so that Jupyter Notebook does not print the object.&#34;&#34;&#34;
        return &#34;&#34;</code></pre>
</details>
</section>
<section>
<h2 class="section-title" id="header-submodules">Sub-modules</h2>
<dl>
<dt><code class="name"><a title="pandas_profiling.config" href="config.html">pandas_profiling.config</a></code></dt>
<dd>
<section class="desc"><p>Configuration for the package is handled in this wrapper for confuse.</p></section>
</dd>
<dt><code class="name"><a title="pandas_profiling.controller" href="controller/index.html">pandas_profiling.controller</a></code></dt>
<dd>
<section class="desc"><p>The controller module handles all user interaction with the package (console, jupyter, etc.).</p></section>
</dd>
<dt><code class="name"><a title="pandas_profiling.model" href="model/index.html">pandas_profiling.model</a></code></dt>
<dd>
<section class="desc"><p>The model module handles all logic/calculations, e.g. calculate statistics, testing for special conditions.</p></section>
</dd>
<dt><code class="name"><a title="pandas_profiling.utils" href="utils/index.html">pandas_profiling.utils</a></code></dt>
<dd>
<section class="desc"><p>Utility functions for the complete package.</p></section>
</dd>
<dt><code class="name"><a title="pandas_profiling.version" href="version.html">pandas_profiling.version</a></code></dt>
<dd>
<section class="desc"><p>This file is auto-generated by setup.py, please do not alter.</p></section>
</dd>
<dt><code class="name"><a title="pandas_profiling.view" href="view/index.html">pandas_profiling.view</a></code></dt>
<dd>
<section class="desc"><p>All functionality concerned with presentation to the user.</p></section>
</dd>
</dl>
</section>
<section>
</section>
<section>
</section>
<section>
<h2 class="section-title" id="header-classes">Classes</h2>
<dl>
<dt id="pandas_profiling.ProfileReport"><code class="flex name class">
<span>class <span class="ident">ProfileReport</span></span>
<span>(</span><span>df, **kwargs)</span>
</code></dt>
<dd>
<section class="desc"><p>Generate a profile report from a Dataset stored as a pandas <code>DataFrame</code>.</p>
<p>Used has is it will output its content as an HTML report in a Jupyter notebook.</p></section>
<details class="source">
<summary>Source code</summary>
<pre><code class="python">class ProfileReport(object):
    &#34;&#34;&#34;Generate a profile report from a Dataset stored as a pandas `DataFrame`.
    
    Used has is it will output its content as an HTML report in a Jupyter notebook.
    &#34;&#34;&#34;

    html = &#34;&#34;
    &#34;&#34;&#34;the HTML representation of the report, without the wrapper (containing `&lt;head&gt;` etc.)&#34;&#34;&#34;

    def __init__(self, df, **kwargs):
        config.set_kwargs(kwargs)

        # Treat index as any other column
        if (
            not pd.Index(np.arange(0, len(df))).equals(df.index)
            or df.index.dtype != np.int64
        ):
            df = df.reset_index()

        # Rename reserved column names
        df = rename_index(df)

        # Remove spaces and colons from column names
        df = clean_column_names(df)

        # Sort column names
        sort = config[&#34;sort&#34;].get(str)
        if sys.version_info[1] &lt;= 5 and sort != &#34;None&#34;:
            warnings.warn(&#34;Sorting is supported from Python 3.6+&#34;)

        if sort in [&#34;asc&#34;, &#34;ascending&#34;]:
            df = df.reindex(sorted(df.columns, key=lambda s: s.casefold()), axis=1)
        elif sort in [&#34;desc&#34;, &#34;descending&#34;]:
            df = df.reindex(
                reversed(sorted(df.columns, key=lambda s: s.casefold())), axis=1
            )
        elif sort != &#34;None&#34;:
            raise ValueError(&#39;&#34;sort&#34; should be &#34;ascending&#34;, &#34;descending&#34; or None.&#39;)

        # Store column order
        config[&#34;column_order&#34;] = df.columns.tolist()

        # Get dataset statistics
        description_set = describe_df(df)

        # Get sample
        sample = {}
        n_head = config[&#34;samples&#34;][&#34;head&#34;].get(int)
        if n_head &gt; 0:
            sample[&#34;head&#34;] = df.head(n=n_head)

        n_tail = config[&#34;samples&#34;][&#34;tail&#34;].get(int)
        if n_tail &gt; 0:
            sample[&#34;tail&#34;] = df.tail(n=n_tail)

        # Render HTML
        self.html = to_html(sample, description_set)
        self.minify_html = config[&#34;minify_html&#34;].get(bool)
        self.use_local_assets = config[&#34;use_local_assets&#34;].get(bool)
        self.title = config[&#34;title&#34;].get(str)
        self.description_set = description_set
        self.sample = sample

    def get_description(self) -&gt; dict:
        &#34;&#34;&#34;Return the description (a raw statistical summary) of the dataset.
        
        Returns:
            Dict containing a description for each variable in the DataFrame.
        &#34;&#34;&#34;
        return self.description_set

    def get_rejected_variables(self, threshold: float = 0.9) -&gt; list:
        &#34;&#34;&#34;Return a list of variable names being rejected for high 
        correlation with one of remaining variables.
        
        Args:
            threshold: correlation value which is above the threshold are rejected (Default value = 0.9)

        Returns:
            A list of rejected variables.
        &#34;&#34;&#34;
        variable_profile = self.description_set[&#34;variables&#34;]
        result = []
        for col, values in variable_profile.items():
            if &#34;correlation&#34; in values:
                if values[&#34;correlation&#34;] &gt; threshold:
                    result.append(col)
        return result

    def to_file(self, output_file: Path or str, silent: bool = True) -&gt; None:
        &#34;&#34;&#34;Write the report to a file.
        
        By default a name is generated.

        Args:
            output_file: The name or the path of the file to generate including the extension (.html).
            silent: if False, opens the file in the default browser
        &#34;&#34;&#34;
        if type(output_file) == str:
            output_file = Path(output_file)

        with output_file.open(&#34;w&#34;, encoding=&#34;utf8&#34;) as f:
            wrapped_html = self.to_html()
            if self.minify_html:
                from htmlmin.main import minify

                wrapped_html = minify(
                    wrapped_html, remove_all_empty_space=True, remove_comments=True
                )
            f.write(wrapped_html)

        if not silent:
            import webbrowser

            webbrowser.open_new_tab(output_file)

    def to_html(self) -&gt; str:
        &#34;&#34;&#34;Generate and return complete template as lengthy string
            for using with frameworks.

        Returns:
            Profiling report html including wrapper.
        
        &#34;&#34;&#34;
        return templates.template(&#34;wrapper.html&#34;).render(
            content=self.html,
            title=self.title,
            correlation=len(self.description_set[&#34;correlations&#34;]) &gt; 0,
            missing=len(self.description_set[&#34;missing&#34;]) &gt; 0,
            sample=len(self.sample) &gt; 0,
            version=__version__,
            offline=self.use_local_assets,
            primary_color=config[&#34;style&#34;][&#34;primary_color&#34;].get(str),
            theme=config[&#34;style&#34;][&#34;theme&#34;].get(str),
        )

    def get_unique_file_name(self):
        &#34;&#34;&#34;Generate a unique file name.&#34;&#34;&#34;
        return (
            &#34;profile_&#34;
            + str(np.random.randint(1000000000, 9999999999, dtype=np.int64))
            + &#34;.html&#34;
        )

    def _repr_html_(self):
        &#34;&#34;&#34;Used to output the HTML representation to a Jupyter notebook.
        When config.notebook.iframe.attribute is &#34;src&#34;, this function creates a temporary HTML file
        in `./tmp/profile_[hash].html` and returns an Iframe pointing to that contents.
        When config.notebook.iframe.attribute is &#34;srcdoc&#34;, the same HTML is injected in the &#34;srcdoc&#34; attribute of
        the Iframe.

        Notes:
            This constructions solves problems with conflicting stylesheets and navigation links.
        &#34;&#34;&#34;
        display_notebook_iframe(self)

    def __repr__(self):
        &#34;&#34;&#34;Override so that Jupyter Notebook does not print the object.&#34;&#34;&#34;
        return &#34;&#34;</code></pre>
</details>
<h3>Class variables</h3>
<dl>
<dt id="pandas_profiling.ProfileReport.html"><code class="name">var <span class="ident">html</span></code></dt>
<dd>
<section class="desc"><p>the HTML representation of the report, without the wrapper (containing <code>&lt;head&gt;</code> etc.)</p></section>
</dd>
</dl>
<h3>Methods</h3>
<dl>
<dt id="pandas_profiling.ProfileReport.get_description"><code class="name flex">
<span>def <span class="ident">get_description</span></span>(<span>self)</span>
</code></dt>
<dd>
<section class="desc"><p>Return the description (a raw statistical summary) of the dataset.</p>
<h2 id="returns">Returns</h2>
<p>Dict containing a description for each variable in the DataFrame.</p></section>
<details class="source">
<summary>Source code</summary>
<pre><code class="python">def get_description(self) -&gt; dict:
    &#34;&#34;&#34;Return the description (a raw statistical summary) of the dataset.
    
    Returns:
        Dict containing a description for each variable in the DataFrame.
    &#34;&#34;&#34;
    return self.description_set</code></pre>
</details>
</dd>
<dt id="pandas_profiling.ProfileReport.get_rejected_variables"><code class="name flex">
<span>def <span class="ident">get_rejected_variables</span></span>(<span>self, threshold=0.9)</span>
</code></dt>
<dd>
<section class="desc"><p>Return a list of variable names being rejected for high
correlation with one of remaining variables.</p>
<h2 id="args">Args</h2>
<dl>
<dt><strong><code>threshold</code></strong></dt>
<dd>correlation value which is above the threshold are rejected (Default value = 0.9)</dd>
</dl>
<h2 id="returns">Returns</h2>
<p>A list of rejected variables.</p></section>
<details class="source">
<summary>Source code</summary>
<pre><code class="python">def get_rejected_variables(self, threshold: float = 0.9) -&gt; list:
    &#34;&#34;&#34;Return a list of variable names being rejected for high 
    correlation with one of remaining variables.
    
    Args:
        threshold: correlation value which is above the threshold are rejected (Default value = 0.9)

    Returns:
        A list of rejected variables.
    &#34;&#34;&#34;
    variable_profile = self.description_set[&#34;variables&#34;]
    result = []
    for col, values in variable_profile.items():
        if &#34;correlation&#34; in values:
            if values[&#34;correlation&#34;] &gt; threshold:
                result.append(col)
    return result</code></pre>
</details>
</dd>
<dt id="pandas_profiling.ProfileReport.get_unique_file_name"><code class="name flex">
<span>def <span class="ident">get_unique_file_name</span></span>(<span>self)</span>
</code></dt>
<dd>
<section class="desc"><p>Generate a unique file name.</p></section>
<details class="source">
<summary>Source code</summary>
<pre><code class="python">def get_unique_file_name(self):
    &#34;&#34;&#34;Generate a unique file name.&#34;&#34;&#34;
    return (
        &#34;profile_&#34;
        + str(np.random.randint(1000000000, 9999999999, dtype=np.int64))
        + &#34;.html&#34;
    )</code></pre>
</details>
</dd>
<dt id="pandas_profiling.ProfileReport.to_file"><code class="name flex">
<span>def <span class="ident">to_file</span></span>(<span>self, output_file, silent=True)</span>
</code></dt>
<dd>
<section class="desc"><p>Write the report to a file.</p>
<p>By default a name is generated.</p>
<h2 id="args">Args</h2>
<dl>
<dt><strong><code>output_file</code></strong></dt>
<dd>The name or the path of the file to generate including the extension (.html).</dd>
<dt><strong><code>silent</code></strong></dt>
<dd>if False, opens the file in the default browser</dd>
</dl></section>
<details class="source">
<summary>Source code</summary>
<pre><code class="python">def to_file(self, output_file: Path or str, silent: bool = True) -&gt; None:
    &#34;&#34;&#34;Write the report to a file.
    
    By default a name is generated.

    Args:
        output_file: The name or the path of the file to generate including the extension (.html).
        silent: if False, opens the file in the default browser
    &#34;&#34;&#34;
    if type(output_file) == str:
        output_file = Path(output_file)

    with output_file.open(&#34;w&#34;, encoding=&#34;utf8&#34;) as f:
        wrapped_html = self.to_html()
        if self.minify_html:
            from htmlmin.main import minify

            wrapped_html = minify(
                wrapped_html, remove_all_empty_space=True, remove_comments=True
            )
        f.write(wrapped_html)

    if not silent:
        import webbrowser

        webbrowser.open_new_tab(output_file)</code></pre>
</details>
</dd>
<dt id="pandas_profiling.ProfileReport.to_html"><code class="name flex">
<span>def <span class="ident">to_html</span></span>(<span>self)</span>
</code></dt>
<dd>
<section class="desc"><p>Generate and return complete template as lengthy string
for using with frameworks.</p>
<h2 id="returns">Returns</h2>
<p>Profiling report html including wrapper.</p></section>
<details class="source">
<summary>Source code</summary>
<pre><code class="python">def to_html(self) -&gt; str:
    &#34;&#34;&#34;Generate and return complete template as lengthy string
        for using with frameworks.

    Returns:
        Profiling report html including wrapper.
    
    &#34;&#34;&#34;
    return templates.template(&#34;wrapper.html&#34;).render(
        content=self.html,
        title=self.title,
        correlation=len(self.description_set[&#34;correlations&#34;]) &gt; 0,
        missing=len(self.description_set[&#34;missing&#34;]) &gt; 0,
        sample=len(self.sample) &gt; 0,
        version=__version__,
        offline=self.use_local_assets,
        primary_color=config[&#34;style&#34;][&#34;primary_color&#34;].get(str),
        theme=config[&#34;style&#34;][&#34;theme&#34;].get(str),
    )</code></pre>
</details>
</dd>
</dl>
</dd>
</dl>
</section>
</article>
<nav id="sidebar">
<h1>Index</h1>
<div class="toc">
<ul>
<li><a href="#pandas-profiling">Pandas Profiling</a><ul>
<li><a href="#examples">Examples</a></li>
<li><a href="#installation">Installation</a><ul>
<li><a href="#using-pip">Using pip</a></li>
<li><a href="#using-conda">Using conda</a></li>
<li><a href="#from-source">From source</a></li>
</ul>
</li>
<li><a href="#usage">Usage</a></li>
<li><a href="#documentation">Documentation</a><ul>
<li><a href="#jupyter-notebook">Jupyter Notebook</a></li>
<li><a href="#command-line-usage">Command line usage</a></li>
<li><a href="#advanced-usage">Advanced usage</a></li>
</ul>
</li>
<li><a href="#how-to-contribute">How to contribute</a></li>
<li><a href="#editor-integration">Editor integration</a><ul>
<li><a href="#pycharm-integration">PyCharm integration</a></li>
<li><a href="#other-integrations">Other integrations</a></li>
</ul>
</li>
<li><a href="#dependencies">Dependencies</a></li>
</ul>
</li>
</ul>
</div>
<ul id="index">
<li><h3><a href="#header-submodules">Sub-modules</a></h3>
<ul>
<li><code><a title="pandas_profiling.config" href="config.html">pandas_profiling.config</a></code></li>
<li><code><a title="pandas_profiling.controller" href="controller/index.html">pandas_profiling.controller</a></code></li>
<li><code><a title="pandas_profiling.model" href="model/index.html">pandas_profiling.model</a></code></li>
<li><code><a title="pandas_profiling.utils" href="utils/index.html">pandas_profiling.utils</a></code></li>
<li><code><a title="pandas_profiling.version" href="version.html">pandas_profiling.version</a></code></li>
<li><code><a title="pandas_profiling.view" href="view/index.html">pandas_profiling.view</a></code></li>
</ul>
</li>
<li><h3><a href="#header-classes">Classes</a></h3>
<ul>
<li>
<h4><code><a title="pandas_profiling.ProfileReport" href="#pandas_profiling.ProfileReport">ProfileReport</a></code></h4>
<ul class="">
<li><code><a title="pandas_profiling.ProfileReport.get_description" href="#pandas_profiling.ProfileReport.get_description">get_description</a></code></li>
<li><code><a title="pandas_profiling.ProfileReport.get_rejected_variables" href="#pandas_profiling.ProfileReport.get_rejected_variables">get_rejected_variables</a></code></li>
<li><code><a title="pandas_profiling.ProfileReport.get_unique_file_name" href="#pandas_profiling.ProfileReport.get_unique_file_name">get_unique_file_name</a></code></li>
<li><code><a title="pandas_profiling.ProfileReport.html" href="#pandas_profiling.ProfileReport.html">html</a></code></li>
<li><code><a title="pandas_profiling.ProfileReport.to_file" href="#pandas_profiling.ProfileReport.to_file">to_file</a></code></li>
<li><code><a title="pandas_profiling.ProfileReport.to_html" href="#pandas_profiling.ProfileReport.to_html">to_html</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.6.2</a>.</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad()</script>
</body>
</html>